package com.imooc.feeds.controller;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.imooc.commons.model.domain.ResultInfo;
import com.imooc.commons.utils.ResultInfoUtil;
import com.imooc.feeds.service.SignService;

/**
 * \* @author: bear
 * \* Date: 2021-08-05-17:41
 * \* describe:
 */
@RestController
public class SignController {

	@Resource
	private HttpServletRequest request;
	@Resource
	private SignService signService;
	/**
	 *  签到，可以补签
	 * @param access_token
	 * @param date  某个日期yyyy-MM-dd 默认当天
	 * @return
	 */
	@PostMapping("sign")
	public ResultInfo<Integer> sign(String access_token,@RequestParam(required = false)String date){

		int count = signService.doSign(access_token,date);
		return ResultInfoUtil.buildSuccess(request.getServletPath(),count);
	}
}
